package ph.com.gs3.formalistics.model.valueobjects.application;

import org.json.JSONException;
import org.json.JSONObject;

import ph.com.gs3.formalistics.global.utilities.TextUtilities;

public class CommentNotification extends Notification {

	private String text;
	private String commentedRequestId;
	private String commentedRequestFormId;

	@Override
	public void initializeFromJSONImpl(JSONObject json) throws JSONException {

		setText(json.getString("comment_text"));
		setCommentedRequestId(json.getString("commented_request_id"));
		setCommentedRequestFormId(json.getString("related_form_id"));

	}

	@Override
	public String getNotificationText() {

		// String notifierName = getNotifier().getDisplayName();
		String ellipsizedText = TextUtilities.ellipsize(getText(), 12, 0);

		return String.format("commented %s on a request you are following", ellipsizedText);

	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getCommentedRequestId() {
		return commentedRequestId;
	}

	public void setCommentedRequestId(String commentedRequestId) {
		this.commentedRequestId = commentedRequestId;
	}

	public String getCommentedRequestFormId() {
		return commentedRequestFormId;
	}

	public void setCommentedRequestFormId(String commentedRequestFormId) {
		this.commentedRequestFormId = commentedRequestFormId;
	}

}
